package com.sas.domain;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

import org.hibernate.annotations.NaturalId;
import org.springframework.util.Assert;


@MappedSuperclass
public class Subject extends PersistentEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = 3333816396725898798L;
	
	@NaturalId
	private String cuilCuit;
	private String name;
	private String description;
	private String email;
	
	
	@OneToOne(cascade = CascadeType.ALL)
	private Address address;
	
	@OneToOne(cascade = CascadeType.ALL)
	private Telephone telephone;

	@OneToOne(cascade = CascadeType.ALL)
	private Telephone alternative;
	@OneToOne(cascade = CascadeType.ALL)
	private Telephone fax;
	@OneToOne(cascade = CascadeType.ALL)
	private Telephone cellphone;
	
	@OneToMany
	private List<Flow> flows;
	
		
	public List<Flow> getFlows() {
		return flows;
	}

	public void setFlows(List<Flow> flows) {
		this.flows = flows;
	}

	Subject () {
		super();
	}

	public String getCuilCuit() {
		return cuilCuit;
	}

	public void setCuilCuit(String cuilCuit) {
		Assert.hasText(cuilCuit);
		this.cuilCuit = cuilCuit;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		Assert.hasText(name);
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		Assert.notNull(description);
		this.description = description;
	}

	public Address getAddress() {
		return address;
	}

	public void setAddress(Address address) {
//		Assert.notNull(address);
		this.address = address;
	}

	public Telephone getTelephone() {
		return telephone;
	}

	public void setTelephone(Telephone telephone) {
		System.out.println(telephone.getCountryCode());
		this.telephone = telephone;
	}

	public Telephone getAlternative() {
		return alternative;
	}

	public void setAlternative(Telephone alternative) {
		this.alternative = alternative;
	}

	public Telephone getFax() {
		return fax;
	}

	public void setFax(Telephone fax) {
		this.fax = fax;
	}

	public Telephone getCellphone() {
		return cellphone;
	}

	public void setCellphone(Telephone cellphone) {
		this.cellphone = cellphone;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}	
}
